const mongoose = require('mongoose');
const orderSchema = new mongoose.Schema({
    customerId: {
        type: String,
        required: true,
        comment:'顾客id' 
    },
    room: {
        type: mongoose.Schema.Types.ObjectId,
        ref: 'Room',
        required: true,
        comment:'关联房间'
    },
    productionStatus:{
        type: Number,
        default:1,
        comment:'制作状态 1/已下单 2/制作中 3/制作完成 4/已送达 5/制作失败'
    },
    productionTime:{
        type: String,
        comment:'制作时间 默认10分钟 超时免费'
    },
    payStatus:{
        type: Number,
        default:0,
        comment:'支付状态 0/未支付 1/已支付 2/其他支付'
    },
    costGoods: {
        type: [String],
        required: true,
        comment:'消费内容'
    },
    notes: {
        type: String,
        comment:'客户备注'
    },
    total: {
        type: String,
        comment:'商品总价格 前端可算 后端也可算'
    },
    evaluate:{
        type: String,
        comment:'服务评价'
    },
    history:{
        type: String,
        comment:'台账记录，因为商品价格可能后期更改，预留记录'
    },
    created_at: {
        type: Date,
        default: Date.now,
    },
    updated_at: {
        type: Date,
        default: Date.now,
    }
});

const Order = mongoose.model('Order', orderSchema);

module.exports = Order;